<link  href="/stylesheets/tests.css" type="text/css" rel="stylesheet" media="screen">

<p style="margin: 5px 0pt;"><%=link_to  '测试管理' , :action=>"index"%>>></p>
<br/>
<div>
  <%= link_to '创建倾向测试', :controller => "t_tests_manage", :action => "new" %> &nbsp;&nbsp;
  <%= link_to '创建计分测试', :controller => "c_tests_manage", :action => "new" %> &nbsp;&nbsp;
  <%= link_to '创建复杂倾向测试', :action => "new" %>
</div>
<br/>
    
<table class="datalist">
  <tr>
    <th scope="col" width="40">序号</th>
    <th scope="col" width="110">测试</th>
    <th scope="col" width="80">测试类型</th>
    <th scope="col"width="60">结果（倾向）数量</th>
    <th scope="col" width="50">题目数量</th>
    <th scope="col"width="50">状态</th>
    <th colspan="6" scope="col" width="200">operation</th>
  </tr>
  
  <% 
    i = 0  
    @tests.each do |test| 
  %>
    <% if i%2 == 0 %>
  <tr>
    <% else %>
  <tr  class="altrow">    
    <% end %>
    
    <td><%=h test.id %></td>    
    <td><%=h test.name %></td>
    <td><%=h test.t_type %></td>
    <td><%= test.trend_scales.size %></td>
    <td><%= test.questions.size %></td>
    <td><%= test.status %></td>
    
    <%if test.t_type==TEST_TYPE_COUNT %>
    
    <td><%= link_to '添加常模', {:id => test, :controller => "c_tests_manage", :action => :new_norm }%></td>
    <td><%= link_to '添加题目', {:id => test, :controller => "c_tests_manage" , :action => :new_question }%></td>
    <td><%= link_to '编辑', {:id => test, :action => :edit } %></td>
    
    <% elsif test.t_type==TEST_TYPE_TREND %>
    
    <td><%= link_to '添加倾向', {:id => test, :controller => "t_tests_manage", :action => :new_trend_scale }%></td>
    <td><%= link_to '添加题目', {:id => test, :controller => "t_tests_manage", :action => :new_question }%></td>
    <td><%= link_to '编辑', {:id => test, :controller => "surveys",:action => :edit } %></td>
    
     <% elsif test.t_type == TEST_TYPE_MANY_TREND %>
    <td><%= link_to '添加倾向', {:id => test, :controller => "t_tests_manage", :action => :new_trend_scale }%></td> 
    <td></td>
    <td><%= link_to '编辑', {:id => test, :controller => "surveys", :action => :edit } %></td>
      
     <% else %>   
    
    <td><%= link_to '添加XX', {:id => test, :controller => "tests_manage", :action => :show }%></td> 
    <td><%= link_to '添加题目', {:id => test, :action => :new_question }%></td>
    <td><%= link_to '编辑', {:id => test, :controller => "surveys", :action => :edit } %></td>
     <% end %>
     
    <td><%= link_to '上线', {:id => test, :action => :finish}  %></td>
    <td><%= link_to '添加图片' , {:id=>test, :action=>:add_image_fortest}  %></td>
    <td><%= link_to '删除', {:id => test,:controller => "surveys", :action => :destroy}, {:confirm => '确定删除?'} %></td>
  </tr>
  <% 
    i += 1
    end 
  %>

</table>

<br/>
